<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登入系统</title>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <link rel="stylesheet" href="static/css/toastr.css">
    <script src="static/js/jquery.min.js"></script>
    <script src="static/js/toastr.min.js"></script>
    <script src="static/js/core.util.js"></script>
    <script src="js/url.js"></script>
</head>
<body>
<div id="wrap">
    <div id="top_content">
        <div id="topheader">
            <h1 id="title">
                <a href="#">我爱登陆</a>
            </h1>
        </div>
        <div id="divStop">
            <p>
                <span>时间：4月10</span>
            </p>
            <a href="#">退出</a>
        </div>
        <div id="navigation">
            <ul>
                <li><a>新闻</a></li>
                <li></li>
                <li></li>
            </ul>
        </div>
        <div id="content" class="div-shadow">
            <p id="whereami"></p>
            <h1>登入系统</h1>
            <p>&nbsp;</p>
            <form id="form" method="post">
                <table class="form_table">
                    <tr>
                        <td>用户名:</td>
                        <td>
                            <input type="text" name="username" class="inputgri" value="admin"/>
                        </td>
                    </tr>
                    <tr>
                        <td>密码:</td>
                        <td>
                            <input type="password" name="pwd" class="inputgri" value="admin"/>
                        </td>
                    </tr>

                </table>

                <p>
                    <input type="button" class="button" value="提交 &raquo;" onclick="login()"/> <a
                        href="register.html">注册新用户</a>
                    <per>
                        用户名：admin 密码：admin
                    </per>
                </p>
                <p>
                </p>
            </form>
        </div>
    </div>
    <div id="footer">
        <div id="footer_bg">whatisJavaWeb@ifly.com</div>
    </div>
</div>
</body>
<script type="text/javascript">

    function login() {
        var formJson = CoreUtil.formJson("form");
        CoreUtil.sendAjax(url + "user/login.action", formJson, function (data) {
            if (data.code == 0) {
                toastr.success(data.msg)
                window.location.href = "list.html";
            } else {
                toastr.error(data.msg);
            }
        });
        /*  // 非json格式
        var username = $("input[name='username']").val() ;
        var pwd = $("input[name='pwd']").val() ;
        $.post("user/login.action",{'username':username,'pwd':pwd},function(data){
            if(data.code==0){
                toastr.success(data.msg)
            }else{
                toastr.error(data.msg);
            }
        },"json");*/
    }
</script>
</html>